package com.atguigu.tingshu.search.task;

import com.atguigu.tingshu.search.service.ItemService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class RebuildBloomFilterTask {

    @Autowired
    private ItemService itemService;


//    @Scheduled(cron = "0 0 2 */7 * ?")
    @Scheduled(cron = "10 * * * * ? ")//测试环境 每十秒钟
//    @Scheduled
    public void rebuildBloomFilterTask(){
        Boolean aBoolean = itemService.rebuildBloomFilter();
        log.info("分布式布隆重建：{}",aBoolean ? "success" : "fail");

    }

}
